﻿
namespace Pivotbrowser.Web.Services
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data;
    using System.Linq;
    using System.ServiceModel.DomainServices.EntityFramework;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;
    using Pivotbrowser.Web;


    // Implements application logic using the Entities context.
    // TODO: Add your application logic to these methods or in additional methods.
    // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access
    // Also consider adding roles to restrict access as appropriate.
    // [RequiresAuthentication]
    [EnableClientAccess()]
    public class ContentDomainService : LinqToEntitiesDomainService<Entities>
    {
        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Fachgruppes' query.
        //public IQueryable<Fachgruppe> GetFachgruppes()
        //{
        //    return this.ObjectContext.Fachgruppes;
        //}

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Prüfung_Student' query.
        public IQueryable<Prüfung_Student> GetPrüfung_Student()
        {
            return this.ObjectContext.Prüfung_Student.Include("SEMESTER").Include("TEILPRÜFUNG").Include("PRÜFUNGSBEMERKUNG").Include("PRÜFUNGSFACH");
        }
        public void UpdatePrüfung_student(Prüfung_Student p)
        {
            this.ObjectContext.Prüfung_Student.AttachAsModified(p, this.ChangeSet.GetOriginal(p));
        }


        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Prüfungsbemerkung' query.
        public IQueryable<Prüfungsbemerkung> GetPrüfungsbemerkung()
        {
            return this.ObjectContext.Prüfungsbemerkung;
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Prüfungsfach' query.
        public IQueryable<Prüfungsfach> GetPrüfungsfach()
        {
            return this.ObjectContext.Prüfungsfach;
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'PrüfungsFachVersion' query.
        public IQueryable<PrüfungsFachVersion> GetPrüfungsFachVersion()
        {
            return this.ObjectContext.PrüfungsFachVersion;
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Semesters' query.
        public IQueryable<Semester> GetSemesters()
        {
            return this.ObjectContext.Semesters;
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'StudAbVers' query.
        public IQueryable<StudAbVer> GetStudAbVers()
        {
            return this.ObjectContext.StudAbVers;
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Students' query.
        public IQueryable<Student> GetStudents()
        {
            return this.ObjectContext.Students  .Include("STUDENTENFACHSEMESTER")
                                                .Include("STUDENTENFACHSEMESTER.SEMESTER")
                                                .Include("PRÜFUNG_STUDENT")
                                                .Include("PRÜFUNG_STUDENT.SEMESTER")
                                                .Include("PRÜFUNG_STUDENT.PRÜFUNGSFACH")
                                                .Include("PRÜFUNG_STUDENT.PRÜFUNGSFACHVERSION")
                                                .Include("PRÜFUNG_STUDENT.PRÜFUNGSBEMERKUNG")
                                                .Include("PRÜFUNG_STUDENT.TEILPRÜFUNG")
                                                .Include("NOTIZEN");
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'StudentenFachSemesters' query.
        public IQueryable<StudentenFachSemester> GetStudentenFachSemesters()
        {
            return this.ObjectContext.StudentenFachSemesters;
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'StudienAbschnitts' query.
        public IQueryable<StudienAbschnitt> GetStudienAbschnitts()
        {
            return this.ObjectContext.StudienAbschnitts;
        }


        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Teilprüfung' query.
        public IQueryable<Teilprüfung> GetTeilprüfung()
        {
            return this.ObjectContext.Teilprüfung;
        }
    }
}


